<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-11-10 15:49:19
         compiled from "H:\WebApplication\myconpany\sumi_mobile\application\views\register\steptow.html" */ ?>
<?php /*%%SmartyHeaderCode:5529561e25709ffca2-21179673%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '9c284f4b1694dee12d385b661c5084be4effd5f1' => 
    array (
      0 => 'H:\\WebApplication\\myconpany\\sumi_mobile\\application\\views\\register\\steptow.html',
      1 => 1447141729,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '5529561e25709ffca2-21179673',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.21-dev',
  'unifunc' => 'content_561e2570b3f102_31912232',
  'variables' => 
  array (
    'codetime' => 0,
    'mobile' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_561e2570b3f102_31912232')) {function content_561e2570b3f102_31912232($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/header.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>


<section class="wrap">
    <!--content stop-->
    <section class="login">
        <ul>
            <li style="line-height:35px; "><b>注册号码：</b><span class="mobile" v="<?php echo $_smarty_tpl->tpl_vars['codetime']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['mobile']->value;?>
</span>
            <span class="phonemsg"></span>
            </li>
            <li class="verification_code">
                <input class="login-code" type="text" maxlength="6" name="code" placeholder="请输入验证码"/>
                <div class="code-pic"><input class="reg-btn" id="reg-btn" type="button" value="获取验证码"/></div>
                <span class="msg" v="false"></span>
            </li>
            <li><input class="login-text" type="password" value="" name="password" placeholder="请输入密码"/>
                <span class="passwordmsg"></span>
            </li>
            <li><input class="login-text" type="password" value="" name="repassword" placeholder="请确认密码"/>
                <span class="repasswordmsg"></span>
            </li>
            <li><input class="login-btn" type="button"  value="完成注册"/></li>
        </ul>
    </section>

    <!--content end-->
    <?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/common/footerlogin.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>


</section>

<style>
    .phonemsg{color:#ff6600;}
    .msg{color: #ff6f17;}
    .repasswordmsg{color: #ff6f17;}
    .passwordmsg{color: #ff6f17;}
</style>
<?php echo '<script'; ?>
 type="text/javascript">

    $(function(){
        $('.smxy').click(function(){
            $('.popup_smxy_bg').show();
            $('.popup_smxy').show();
        });

        $('.close_smxy').click(function(){
            $('.popup_smxy_bg').hide();
            $('.popup_smxy').hide();
        });
    });


    $(function(){
        var Obmobile = $(".mobile");
        var Obcode = $("input[name=code]");
        var Obpasswd = $("input[name=password]");
        var Obrepasswd = $("input[name=repassword]");
        //下一步注册
        $('.login-btn').click(function(){
            if(codeEmpty(Obcode) === false || passwdEmpty() === false  || repasswdEmpty === false){
                return false;
            }else{
                var mobile = Obmobile.text();

                var passwd = Obpasswd.val();
                var repasswd = Obrepasswd.val();
                var codetime = Obmobile.attr("v");
                $.ajax({
                    url:'/register/savereg',
                    data:{mobile:mobile,passwd:passwd,repasswd:repasswd,codetime:codetime},
                    type:'POST',
                    success:function(data){
                        var data = eval("("+data+")");
                        var code = data.code;
                        var msg = data.msg;
                        var data = data.data;
                        if(code == 99){
                            $('.msg').html(msg);
                            $('.msg').attr("v","false");
                            return;
                        }else{
                            window.location.href="/user";
                            return true;
                        }
                    },
                    dataType:'text'
                });

            }
        });


        var count = 60;
        var myCountDown;
        $(function(){
            $(".reg-btn").click(function(){
                myCountDown = setInterval(countDown,1000);

                var mobile = Obmobile.text();
                var codetime = Obmobile.attr("v");
                $.ajax({
                    url:'/register/sendcode',
                    data:{mobile:mobile,codetime:codetime},
                    type:'POST',
                    success:function(data){

                        if(data == "-6"){
                            $(".msg").html("不允许重复发送");
                            return;
                        }
                        if(data == "-5"){
                            $(".msg").html("手机号码不正确");
                            return;
                        }
                        return true;
                    },
                    dataType:'text'
                });
            });
        });

        function countDown(){
            $(".reg-btn").attr("disabled",true);
            $(".reg-btn").css("background","#999999");
            $(".reg-btn").val("重新获取验证码 （"+ count +"）");
            count--;
            if(count==0){
                $(".reg-btn").val("获取验证码").removeAttr("disabled");
                $(".reg-btn").css("background","#ff6f17");
                clearInterval(myCountDown);
                count = 60;
            }
        }



        Obcode.blur(function(){
            codeEmpty(Obcode);
        });

        Obpasswd.blur(function(){
            repasswdEmpty();
        })
        Obrepasswd.blur(function(){
            passwdEmpty();
        })
    });

    function passwdEmpty(){
        var passwd = $("input[name=password]").val();
        if(passwd==''){
            $('.passwordmsg').html("请输入密码！");
            return false;
        }else if(passwd.length<6||passwd.length>=26){
            $('.passwordmsg').html("密码为6-20位字符！");
            return false;
        }else{
            $('.passwordmsg').html("");
            return true;
        }

    }


    function repasswdEmpty(){
        var passwd = $("input[name=password]").val();
        var repasswd = $("input[name=repassword]").val();

        if(repasswd != passwd){
            $('.repasswordmsg').html("确认密码输入不正确！");
            return false;
        }else{
            $('.repasswordmsg').html("");
            return true;
        }

    }

    function codeEmpty(obj){
        var code = obj.val();
        var mobile = $(".mobile").text();
        if(code==''){
            $('.msg').html("请输入验证码！");
            $('.msg').attr("v","false");
            return false;
        }else{
            $.ajax({
                url:'/register/confirmPhonecode',
                data:{code:code,mobile:mobile},
                type:'POST',
                success:function(data){
                    var data = eval("("+data+")");
                    var code = data.code;
                    var msg = data.msg;
                    var data = data.data;
                    if(code == 99){
                        $('.msg').html(msg);
                        $('.msg').attr("v","false");
                        return;
                    }else{
                        $('.msg').html("");
                        $('.msg').attr("v","true");
                        return true;
                    }
                },
                dataType:'text'
            });
            var stauts =$('.msg').attr("v");
            if(stauts == 'false'){
                return false;
            }else{
                return true;
            }
        }
    }
<?php echo '</script'; ?>
>

<div class="popup_smxy_bg"></div>

<?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/footer.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>


<?php }} ?>
